package com.shenmazong.utils;

/**
 * @author 军哥
 * @version 1.0
 * @description: 标准返回类
 * @date 2022/4/3 9:42
 */


public class ResultResponse {

    private Integer code;
    private String msg;
    private Object data;

    private ResultResponse(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data =data;
    }

    public static ResultResponse SUCCESS() {
        ResultResponse response = new ResultResponse(200, "操作成功", null);
        return response;
    }

    public static ResultResponse SUCCESS(Object data) {
        ResultResponse response = new ResultResponse(200, "操作成功", data);
        return response;
    }

    public static ResultResponse FAILED(Integer code, String msg) {
        ResultResponse response = new ResultResponse(code, msg, null);
        return response;
    }

    public static ResultResponse FAILED(Integer code, String msg, Object data) {
        ResultResponse response = new ResultResponse(code, msg, data);
        return response;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
